package com.lb.jwitter.action;


 import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import com.lb.jwitter.util.ApplicationContextProvider; 
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext; 
import org.springframework.test.context.ContextConfiguration;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import com.opensymphony.xwork2.Action; 
import java.util.Map; 
import com.opensymphony.xwork2.ActionContext; 
import com.lb.jwitter.service.ConditionReport; 
import com.lb.jwitter.service.TblQuyenChiTietService;import com.lb.jwitter.service.TblTaiKhoan;import com.lb.jwitter.service.TblDKMHKetqua;
import com.lb.jwitter.service.TblDKMHKetquaService;
import com.lb.jwitter.service.TblDKMHDotDK;
import com.lb.jwitter.service.TblDKMHDotDKService;

import com.lb.jwitter.service.TblThongTinHocVien;
import com.lb.jwitter.service.TblThongTinHocVienService;

import com.lb.jwitter.service.TblThongTinNhomLopMonHoc;
import com.lb.jwitter.service.TblThongTinNhomLopMonHocService;

import com.lb.jwitter.service.TblCanBo;
import com.lb.jwitter.service.TblCanBoService;

 /** 
 * @author QUOCVIET  
 * 
 */ 


@ContextConfiguration(locations="classpath:beans.xml") 
public class TblDKMHKetquaFormAction{
    private int pageSize; 
    public int getPageSize() {
       return pageSize;
 }

    public void setPageSize(int pageSize) { this.pageSize = pageSize; }

    private int page; 
    public int getPage() { return page; }

    public void setPage(int page) { this.page = page; }

    private int pages; 
    public int getPages() { return pages; }

    public void setPages(int pages) { this.pages = pages; }

    private String dataString; 
    public String getDataString() { return dataString; }

    private Collection<TblDKMHKetqua> tblDKMHKetquas; 
    public Collection<TblDKMHKetqua>  getTblDKMHKetquas() {
         return tblDKMHKetquas; 
      } 

    private TblDKMHKetquaService tblDKMHKetquaService; 

    private Collection<TblDKMHDotDK> tblDKMHDotDKs; 
    public Collection<TblDKMHDotDK>  getTblDKMHDotDKs(){ 
              return tblDKMHDotDKs; 
     } 

    private TblDKMHDotDKService tblDKMHDotDKService; 

    private Collection<TblThongTinHocVien> tblThongTinHocViens; 
    public Collection<TblThongTinHocVien>  getTblThongTinHocViens(){ 
              return tblThongTinHocViens; 
     } 

    private TblThongTinHocVienService tblThongTinHocVienService; 

    private Collection<TblThongTinNhomLopMonHoc> tblThongTinNhomLopMonHocs; 
    public Collection<TblThongTinNhomLopMonHoc>  getTblThongTinNhomLopMonHocs(){ 
              return tblThongTinNhomLopMonHocs; 
     } 
    
    private int dotDKId;

    public int getDotDKId() {
		return dotDKId;
	}

	public void setDotDKId(int dotDKId) {
		this.dotDKId = dotDKId;
	}

	private TblThongTinNhomLopMonHocService tblThongTinNhomLopMonHocService; 

    private Collection<TblCanBo> tblCanBos; 
    public Collection<TblCanBo>  getTblCanBos(){ 
              return tblCanBos; 
     } 

    private TblCanBoService tblCanBoService; 

  private TblTaiKhoan taiKhoanDangNhap; 
 public TblTaiKhoan getTaiKhoanDangNhap() { 
     return taiKhoanDangNhap; 
 } 
 public void setTaiKhoanDangNhap(TblTaiKhoan taiKhoanDangNhap) { 
     this.taiKhoanDangNhap = taiKhoanDangNhap; 
 } 
 private TblQuyenChiTietService tblQuyenChiTietService;
	 @Autowired // Injected by Spring 
     ApplicationContextProvider contextProvider; 
 public String execute() throws Exception 
{ 
 try{ 	
     Map session = ActionContext.getContext().getSession();
     taiKhoanDangNhap =  (TblTaiKhoan) session.get("taiKhoan");
     if( taiKhoanDangNhap == null) return "noprivilege";
    ApplicationContext context = ApplicationContextProvider.getApplicationContext(); 
    tblQuyenChiTietService = (TblQuyenChiTietService) context.getBean("tbl_Quyen_ChiTietClient"); 
    if(!tblQuyenChiTietService.checkRight(taiKhoanDangNhap.getMaNhomQuyen().getId(), "tbl_DKMH_Ketqua", "xem")){ 
        return "noprivilege"; 
    }
         
    tblDKMHDotDKService = (TblDKMHDotDKService) context.getBean("tbl_DKMH_DotDKClient"); 
    tblThongTinNhomLopMonHocService = (TblThongTinNhomLopMonHocService) context.getBean("tbl_ThongTin_NhomLop_MonHocClient"); 

       
      dataString = ""; 
      dataString += "&dotDKId=" ; 
      dataString += "&mssv=" ; 
      dataString += "&nLMHId=" ; 
      dataString += "&ketQua="; 
      dataString += "&tungayDangKy="; 
      dataString += "&denngayDangKy="; 
      dataString += "&tungayCapNhat="; 
      dataString += "&denngayCapNhat="; 
      dataString += "&xacNhanYN="; 
      dataString += "&tinhTrang="; 
      
      List<ConditionReport> cons = new ArrayList<ConditionReport>();
      {
    	  ConditionReport con = new ConditionReport();  
           con.setCol("id");
          con.setValue1("desc");
          con.setOperator("order");
          cons.add(con);
      }
      tblDKMHDotDKs = tblDKMHDotDKService.findtblDKMHDotDKByCondition(cons, 20, 1);
      
      return Action.SUCCESS; 
      } 
      catch(Exception e){ 
      System.out.println("Loi Form tbl_DKMH_Ketqua Action"); 
     e.printStackTrace(); 
    return Action.ERROR; 
 } 
 } 
 } 
 
